package net.core.service.encrype;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class MD5Test {

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testGetMD5ofStr() {
		String user="155000000522406";
		String pwd = "abc123";
		short k =15;
		byte[] b1 = shortToByteArray(k);
		for(int i=0;i<b1.length;i++){
			System.out.println(b1[i]);
		}
		String s = (new MD5()).getMD5ofStr(user+pwd);
		//System.out.println(s);
		byte[] aw = user.getBytes();
		for(int i=0;i<aw.length;i++){
			System.out.println(aw[i]);
		}
		
		//byte[] b1 = {63,169,61,71,66,1,0,0};
	}
	
	private static byte[] shortToByteArray(short s) {
		  byte[] shortBuf = new byte[2];
		  for(int i=0;i<2;i++) {
		     int offset = (shortBuf.length - 1 -i)*8;
		     shortBuf[1-i] = (byte)((s>>>offset)&0xff);
		  }
		  return shortBuf;
		 }

}
